<template>
    <van-sticky :offset-top="0">
        <van-nav-bar :title="data[active].name" left-text="返回" left-arrow @click-left="onClickLeft" />
    </van-sticky>
    <router-view></router-view>
    <van-tabbar v-model="active" route>
        <van-tabbar-item v-for=" i in data" :icon="i.icon" :to="i.to">{{i.name}}</van-tabbar-item>
    </van-tabbar>

</template>

<script setup>
import { useRouter } from 'vue-router';
let router=useRouter()
const onClickLeft = () => router.go(-1);
import { ref } from 'vue';

const active = ref(0);
let data=ref([
    {
        name:'首页',
        icon:'wap-home-o',
        to:'/home/shouye',
    },
    {
        name:'分类',
        icon:'bag-o',
        to:'/home/class',
    },
    {
        name:'购物车',
        icon:'cart-o',
        to:'/home/shop',
    },
    {
        name:'我的',
        icon:'friends-o',
        to:'/home/my',
    }
])
</script>

<style lang="scss" scoped></style>